import defaultjson from '@/json/defaultValue'
import deepClone from '@/z/callback/deepClone'
import deepMerge from '@/z/callback/deepMerge'
let qcctype = defaultjson.qcctype
// let
let ChargeSetaddjson = [
  {
    label: '桩号',
    value: 'gtel',
    rule: [{ required: true, message: '请输入桩号', trigger: 'blur' }],
  },
  {
    label: '设置类型',
    value: 'lx',
    type: 'select',
    rule: [{ required: true, message: '请选择', trigger: 'blur' }],
    options: [
      {
        label: '开始充电',
        value: '1',
        gets: [
          {
            label: '通道',
            value: 'xt',
            rule: [
              { required: true, message: '请输入通道号', trigger: 'blur' },
            ],
          },
        ],
      },
      {
        label: '结束充电',
        value: '2',
        gets: [
          {
            label: '通道',
            value: 'xt',
            rule: [
              { required: true, message: '请输入通道号', trigger: 'blur' },
            ],
          },
        ],
      },
      {
        label: '等待时间',
        value: '3',
        gets: [
          {
            label: '等待时间',
            value: 'xt',
            dw: '分钟',
            defaultValue: '5',
            rule: [{ required: true, message: '请输入分钟', trigger: 'blur' }],
          },
        ],
      },
      {
        label: '远程开锁',
        value: '4',
      },
      {
        label: '心跳周期',
        value: '5',
        gets: [
          {
            label: '心跳周期',
            value: 'xt',
            dw: '秒',
            defaultValue: '60',
            rule: [
              { required: true, message: '请输入心跳周期', trigger: 'blur' },
            ],
          },
        ],
      },
      {
        label: '修改设备ID',
        value: '6',
        gets: [
          {
            label: '设备桩号',
            value: 'newgtel',
            rule: [
              { required: true, message: '请输入设备桩号', trigger: 'blur' },
            ],
          },
          { label: '验证码', value: 'yzm', type: 'utel' },
        ],
      },
      {
        label: '设置设备IP和端口',
        value: '7',
        gets: [
          {
            label: '服务器IP',
            value: 'ip',
            bindingvalue: { attr: 'ChargeCfg', value: 'ip' },
          },
          {
            label: '服务器端口',
            value: 'port',
            bindingvalue: { attr: 'ChargeCfg', value: 'port' },
          },
        ],
      },
      {
        label: '设备远程升级',
        value: '8',
        gets: [
          {
            label: '升级类型',
            value: 'xt',
            placeholder: '1.主板升级2.底板升级',
            rule: [
              { required: true, message: '请输入升级类型', trigger: 'blur' },
            ],
          },
        ],
      },
      {
        label: '涓流时间',
        value: '30',
        gets: [
          {
            label: '涓流时间',
            value: 'xt',
            placeholder: '请输入时间（分钟）',
            defaultValue: '60',
            dw: '分钟',
            bindingvalue: { attr: 'ChargeCfg', value: 'jlsj' },
          },
        ],
      },
      {
        label: '设置电流最大值',
        value: '11',
        gets: [
          {
            label: '电流最大值',
            value: 'xt',
            placeholder: '请输入（以A为单位）',
            dw: 'A',
            fl: 10,
            defaultValue: '4',
            bindingvalue: { attr: 'ChargeCfg', value: 'maxdl' },
          },
        ],
      },
      {
        label: '重启设备',
        value: '12',
      },
      {
        label: '设置设备音量',
        value: '27',
        gets: [
          {
            label: '音量大小',
            value: 'xt',
            defaultValue: '1',
            bindingvalue: { attr: 'ChargeCfg', value: 'b_yy' },
            rule: [{ pattern: /^([0-9]|1[0-5])$/, message: '音量大小：0-15' }],
          },
        ],
      },
      {
        label: '关闭人体语音播报',
        value: '15',
      },
      {
        label: '打开烟雾报警检测',
        value: '16',
      },
      {
        label: '关闭烟雾报警检测',
        value: '17',
      },
      {
        label: '打开硬件过流检测',
        value: '18',
      },
      {
        label: '关闭硬件过流检测',
        value: '19',
      },
      {
        label: '打开插拔检测功能',
        value: '20',
      },
      {
        label: '关闭插拔检测功能',
        value: '21',
      },
      {
        label: '投币箱1元充电时间设置和是否启用',
        value: '23',
        gets: [
          {
            label: '是否使用',
            value: 'port',
            type: 'select',
            options: [
              {
                label: '否',
                value: '0',
              },
              {
                label: '是',
                value: '1',
              },
            ],
            defaultValue: '0',
            bindingvalue: { attr: 'ChargeCfg', value: 'b_tb' },
          },
          {
            label: '充电时间',
            value: 'xt',
            placeholder: '请输入时间（分）',
            bindingvalue: { attr: 'ChargeCfg', value: 'tbsj' },
          },
        ],
      },
      {
        label: '开始充电（不自动关闭的充电）',
        value: '25',
      },
      {
        label: '设置断开检测次数',
        value: '26',
        gets: [
          {
            label: '断电检查次数',
            value: 'xt',
            placeholder: '请输入（次）',
            defaultValue: '5',
            bindingvalue: { attr: 'ChargeCfg', value: 'ddjcc' },
          },
        ],
      },
      {
        label: '设备温度报警值',
        value: '31',
        if: 'gtype',
        nozhi: qcctype,
        gets: [
          {
            label: '报警值',
            value: 'xt',
            defaultValue: '0',
            zzstr: '报警值最大值为254',
            bindingvalue: { attr: 'ChargeCfg', value: 'wdsbal' },
            rule: [
              {
                pattern: /^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-6])$/,
                message: '请输入(最大值为256)',
              },
            ],
          },
        ],
      },
      {
        label: '风扇最高温度',
        value: '31',
        if: 'gtype',
        zhi: qcctype,
        gets: [{ label: '温度阈值', value: 'xt', dw: '度' }],
      },
      {
        label: '电缆温度报警值',
        value: '32',
        if: 'gtype',
        nozhi: qcctype,
        gets: [
          {
            label: '报警值',
            value: 'xt',
            defaultValue: '0',
            bindingvalue: { attr: 'ChargeCfg', value: 'wdxlal' },
            rule: [
              {
                pattern: /^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-6])$/,
                message: '请输入(最大值为256)',
              },
            ],
          },
        ],
      },
      {
        label: '风扇最低温度',
        value: '32',
        if: 'gtype',
        zhi: qcctype,
        gets: [{ label: '最低温度阈值', value: 'xt', dw: '度' }],
      },
      {
        label: '设置涓流电流值',
        value: '33',
        gets: [
          {
            label: '涓流电流值',
            value: 'xt',
            placeholder: '涓流电流值(以10毫安为单位)',
            defaultValue: '',
            bindingvalue: { attr: 'ChargeCfg', value: 'jldl' },
          },
        ],
      },
      {
        label: '设置断开电流值',
        value: '34',
        gets: [
          {
            label: '断开电流值',
            value: 'xt',
            placeholder: '断开电流值(以毫安为单位，最大值255)',
            defaultValue: '',
            bindingvalue: { attr: 'ChargeCfg', value: 'dkdl' },
          },
        ],
      },
      {
        label: '开面板灯',
        value: '36',
      },
      {
        label: '关面板灯',
        value: '37',
      },
      {
        label: '打开插拔断电',
        value: '38',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '关闭插拔断电',
        value: '39',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '打开防倾倒',
        value: '38',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '关闭防倾倒',
        value: '39',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '触摸副板远程升级',
        value: '41',
      },
      {
        label: '打开软件过流检测',
        value: '43',
      },
      {
        label: '关闭软件过流检测',
        value: '44',
      },
      {
        label: '打开第二报警服务器',
        value: '46',
      },
      {
        label: '关闭第二报警服务器',
        value: '47',
      },
      {
        label: '远程读表',
        value: '48',
      },
      {
        label: '查询系统参数',
        value: '52',
      },
      {
        label: '打开充满自停',
        value: '55',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '关闭充满自停',
        value: '56',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '打开设备指示灯',
        value: '55',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '关闭设备指示灯',
        value: '56',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '读取流量卡号',
        value: '61',
      },
      {
        label: '开启温度报警',
        value: '65',
      },
      {
        label: '关闭温度报警',
        value: '66',
      },
      {
        label: '设置温度报警时长',
        value: '67',
        gets: [
          {
            label: '报警时长',
            value: 'xt',
            placeholder: '请输入时间（秒）',
            defaultValue: '',
            dw: '秒',
            rule: [
              {
                pattern: /^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-6])$/,
                message: '请输入(最大值为256)',
              },
            ],
          },
        ],
      },
      {
        label: '重启分布式分机',
        value: '68',
        gets: [
          {
            label: '分机ID',
            value: 'newgtel',
            placeholder: '分机ID',
            defaultValue: '',
          },
        ],
      },
    ],
  },
]
let ChargeAskaddjson = [
  {
    label: '桩号',
    value: 'gtel',
    rule: [{ required: true, message: '请输入桩号', trigger: 'blur' }],
  },
  {
    label: '设置类型',
    value: 'lx',
    type: 'select',
    rule: [{ required: true, message: '请选择', trigger: 'blur' }],
    options: [
      {
        label: '开始充电',
        value: '1',
        gets: [
          {
            label: '通道',
            value: 'td',
            rule: [
              { required: true, message: '请输入通道号', trigger: 'blur' },
            ],
          },
          {
            label: '充电模式',
            value: 'xt',
            type: 'select',
            options: [
              {
                label: '时间模式',
                value: '0',
              },
              {
                label: '计量模式',
                value: '1',
              },
            ],
            defaultValue: '0',
          },
          { label: '充电时长', value: 'cdsj', if: 'xt', zhi: ['0'] },
          {
            label: '充电金额',
            value: 'port',
            if: 'xt',
            zhi: ['1'],
            dw: '元',
            fl: '100',
            rule: [
              {
                required: true,
                message: '请输入充电金额',
                trigger: 'blur',
              },
              // { pattern: this.$z.test.amount(), message: '金额错误' },
            ],
          },
        ],
      },
      {
        label: '结束充电',
        value: '2',
        gets: [{ label: '通道', value: 'td' }],
      },
      {
        label: '直通模式打开或者关闭',
        value: '3',
        gets: [
          { label: '通道', value: 'td' },
          {
            label: '直通模式',
            value: 'xt',
            type: 'select',
            options: [
              {
                label: '关闭',
                value: '0',
              },
              {
                label: '打开',
                value: '1',
              },
            ],
            defaultValue: '0',
          },
        ],
      },
      {
        label: '重新设置用户充电剩余时长',
        value: '4',
        gets: [
          { label: '通道', value: 'td' },
          {
            label: '充电模式',
            value: 'xt',
            type: 'select',
            options: [
              {
                label: '时间模式',
                value: '0',
              },
              {
                label: '计量模式',
                value: '1',
              },
            ],
            defaultValue: '0',
          },
          { label: '充电时长', value: 'cdsj', if: 'xt', zhi: ['0'] },
          {
            label: '充电金额',
            value: 'port',
            if: 'xt',
            zhi: ['1'],
            dw: '元',
            fl: '100',
            rule: [
              {
                required: true,
                message: '请输入充电金额',
                trigger: 'blur',
              },
              // { pattern: this.$z.test.amount(), message: '金额错误' },
            ],
          },
        ],
      },
      {
        label: '设置新的设备序列号',
        value: '6',
        gets: [
          { label: '设备桩号', value: 'newgtel' },
          { label: '验证码', value: 'yzm', type: 'utel' },
        ],
      },
      {
        label: '设置设备IP和端口',
        value: '7',
        gets: [
          {
            label: '服务器IP',
            value: 'ip',
            bindingvalue: { attr: 'ChargeCfg', value: 'ip' },
          },
          {
            label: '服务器端口',
            value: 'port',
            bindingvalue: { attr: 'ChargeCfg', value: 'port' },
          },
        ],
      },
      {
        label: '设备远程升级',
        value: '8',
      },
      {
        label: '设置浮充时间',
        value: '10',
        gets: [
          { label: '浮充时间', value: 'xt', dw: '分钟', defaultValue: '80' },
        ],
      },
      {
        label: '充电口功率最大值',
        value: '11',
        gets: [
          {
            label: '充电口功率最大值',
            value: 'xt',
            dw: '瓦',
            defaultValue: '800',
            bindingvalue: { attr: 'ChargeCfg', value: 'maxdl' },
          },
        ],
      },
      {
        label: '重启设备',
        value: '12',
      },
      {
        label: '设备模式',
        value: '13',
        gets: [
          {
            label: '设备模式',
            value: 'xt',
            type: 'select',
            options: [
              {
                label: '免费',
                value: '0',
              },
              {
                label: '收费',
                value: '1',
              },
            ],
            defaultValue: '1',
          },
        ],
      },
      {
        label: '打开烟雾报警检测',
        value: '16',
      },
      {
        label: '关闭烟雾报警检测',
        value: '17',
      },
      {
        label: '投币箱1元充电时间设置和是否启用',
        value: '23',
        gets: [
          {
            label: '投币是否启用',
            value: 'port',
            type: 'select',
            options: [
              {
                label: '不启用',
                value: '0',
              },
              {
                label: '启用',
                value: '1',
              },
            ],
            defaultValue: '0',
            bindingvalue: { attr: 'ChargeCfg', value: 'b_tb' },
          },
          {
            label: '1元充电时间设置',
            value: 'xt',
            dw: '分钟',
            defaultValue: '240',
            bindingvalue: { attr: 'ChargeCfg', value: 'tbsj' },
          },
        ],
      },
      {
        label: '设置断电检测时间',
        value: '26',
        gets: [
          {
            label: '断电检测时间',
            value: 'xt',
            placeholder: '请输入（秒）',
            defaultValue: '30',
            dw: '秒',
          },
        ],
      },
      {
        label: '设置设备音量',
        value: '27',
        gets: [
          {
            label: '音量大小',
            value: 'xt',
            placeholder: '音量大小：0-15',
            defaultValue: '3',

            bindingvalue: { attr: 'ChargeCfg', value: 'b_yy' },
            rule: [{ pattern: /^([0-9]|1[0-5])$/, message: '音量大小：0-15' }],
          },
        ],
      },
      {
        label: 'IC卡充值',
        value: '28',
        gets: [
          {
            label: '充值金额',
            value: 'xt',
            dw: '元',
            fl: 100,
            rule: [
              {
                required: true,
                message: '请输入充电金额',
                trigger: 'blur',
              },
              // { pattern: this.$z.test.amount(), message: '金额错误' },
            ],
          },
        ],
      },
      {
        label: '设置设备刷卡区域',
        value: '29',
      },
      {
        label: '设备温度报警值',
        if: 'gtype',
        nozhi: qcctype,
        value: '31',
        gets: [{ label: '温度报警值', value: 'xt', dw: '度' }],
      },
      {
        label: '风扇最高温度',
        value: '31',
        if: 'gtype',
        zhi: qcctype,
        gets: [
          { label: '最低温度阈值', value: 'xt', defaultValue: '75', dw: '度' },
        ],
      },
      {
        label: '电缆温度报警值',
        value: '32',
        if: 'gtype',
        nozhi: qcctype,
        gets: [
          { label: '温度报警值', value: 'xt', defaultValue: '75', dw: '度' },
        ],
      },
      {
        label: '风扇最低温度',
        value: '32',
        if: 'gtype',
        zhi: qcctype,
        gets: [
          { label: '最低温度阈值', value: 'xt', defaultValue: '75', dw: '度' },
        ],
      },
      {
        label: '设置涓流功率值',
        value: '33',
        gets: [
          {
            label: '涓流功率值',
            value: 'xt',
            defaultValue: '10',
            dw: '瓦',
            bindingvalue: { attr: 'ChargeCfg', value: 'jldl' },
          },
        ],
      },
      {
        label: '设置断开功率值',
        value: '34',
        gets: [
          {
            label: '断开功率值',
            value: 'xt',
            defaultValue: '2',
            dw: '瓦',
            bindingvalue: { attr: 'ChargeCfg', value: 'dkdl' },
          },
        ],
      },
      {
        label: '最大充电时长',
        value: '35',
        gets: [
          {
            label: '最大充电时长',
            value: 'xt',
            dw: '分钟',
          },
        ],
      },
      {
        label: '开面板灯',
        value: '36',
      },
      {
        label: '关面板灯',
        value: '37',
      },
      {
        label: '打开插拔断电',
        value: '38',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '关闭插拔断电',
        value: '39',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '打开防倾倒',
        value: '38',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '关闭防倾倒',
        value: '39',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '触摸副板远程升级',
        value: '41',
      },
      {
        label: '打开充电口过流检测',
        value: '43',
      },
      {
        label: '关闭充电口过流检测',
        value: '44',
      },
      {
        label: '打开第二报警服务器',
        value: '46',
      },
      {
        label: '关闭第二报警服务器',
        value: '47',
      },
      {
        label: '查询系统参数',
        value: '52',
      },

      {
        label: '打开充满自停',
        value: '55',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '关闭充满自停',
        value: '56',
        if: 'gtype',
        nozhi: qcctype,
      },
      {
        label: '打开设备指示灯',
        value: '55',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '关闭设备指示灯',
        value: '56',
        if: 'gtype',
        zhi: qcctype,
      },
      {
        label: '设置设备全卡通卡号',
        value: '57',
        gets: [
          {
            label: '印刷卡号',
            value: 'newgtel',
            bindingvalue: { attr: 'ChargeCfg', value: 'cardid' },
          },
        ],
      },
      {
        label: '清除硬件投币信息',
        value: '61',
      },
      {
        label: '打开条形支付',
        value: '62',
      },
      {
        label: '关闭条形码支付',
        value: '63',
      },
      {
        label: '获取充电柜温度',
        value: '65',
      },
      {
        label: '强制模块化',
        value: '71',
      },
      {
        label: '取消强制模块化',
        value: '72',
      },
    ],
  },
]
// let
let chargesetjson = []

function chargesetjsonrfn(json, ifjson = {}) {
  let r = []
  let rjson = deepClone(json)
  // console.log(rjson, 1111)
  rjson.forEach((e) => {
    e.if = e.if ? e.if : {}
    e.if = deepMerge(e.if, ifjson)
    r.push(e)
    if (e.type == 'select') {
      e.options.forEach((option) => {
        if (typeof option.gets == 'object') {
          let rif = deepMerge(e.if, {
            zhi: [{ value: e.value, zhi: [option.value] }],
          })

          r = r.concat(chargesetjsonrfn(option.gets, rif))
        }
      })
    }
  })
  return r
}
chargesetjson = chargesetjson
  .concat(
    chargesetjsonrfn(ChargeSetaddjson, {
      zhierror: [{ value: 'b_ask', zhi: ['1'] }],
    })
  )
  .concat(
    chargesetjsonrfn(ChargeAskaddjson, {
      zhi: [{ value: 'b_ask', zhi: ['1'] }],
    })
  )
// console.log(chargesetjson, ChargeAskaddjson, qcctype)
let chargecarsetjson = [{ label: '桩号', value: 'gtel', type: 'button' }]
let ChargeSetaddjsoncar = [
  {
    label: '涓流时间',
    value: 'fcsj',
    dw: '分钟',
    typevalue: '30',
    upvalue: 'xt',
  },
  {
    label: '涓流电流值',
    value: 'jldl',
    dw: '0.01A',
    typevalue: '33',
    upvalue: 'xt',
  },
  {
    label: '断电检测次数',
    value: 'ddjcc',
    dw: '次',
    typevalue: '26',
    upvalue: 'xt',
  },
  {
    label: '声音调节',
    value: 'b_yy',
    dw: '级(db)',
    typevalue: '27',
    upvalue: 'xt',
  },
  {
    label: '电流最大值',
    value: 'maxdl',
    dw: 'A',
    typevalue: '11',
    upvalue: 'xt',
    defaultValue: '4',
    fl: '10',
  },
  {
    label: '防扰民',
    value: 'b_atyy',
    type: 'switch',
    upvalue: 'b_atyy',
    typevalue: 'b_atyy',
    typeurl: '/ChargeCfgedt',
  },
  {
    label: '投币箱',
    value: 'b_tb',
    type: 'switch',
    typevalue: '23',
    upvalue: 'port',
  },
  {
    label: '充电时间',
    value: 'tbsj',
    dw: '分',
    defaultValue: '240',
    typevalue: '23',
    upvalue: 'xt',
    if: { zhi: [{ value: 'b_tb', zhi: ['1'] }] },
  },
  {
    label: '插拔检测',
    value: 'b_dd',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['39', '38'],
  },
  {
    label: '面板灯开关',
    value: 'b_dg',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['37', '36'],
  },
  {
    label: '充满自停',
    value: 'b_cbdd',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['56', '55'],
  },
]
let ChargeSetaddjsoncarb_ask = [
  {
    label: '涓流时间',
    value: 'fcsj',
    dw: '分钟',
    typevalue: '10',
    upvalue: 'xt',
  },
  {
    label: '涓流功率值',
    value: 'jldl',
    dw: '瓦',
    typevalue: '33',
    upvalue: 'xt',
  },
  {
    label: '断电检测时间',
    value: 'ddjcc',
    dw: '秒',
    typevalue: '26',
    upvalue: 'xt',
  },
  {
    label: '声音调节',
    value: 'b_yy',
    dw: '级(db)',
    typevalue: '27',
    upvalue: 'xt',
  },
  {
    label: '功率最大值',
    value: 'maxdl',
    dw: '瓦',
    typevalue: '11',
    upvalue: 'xt',
    defaultValue: '800',
  },
  {
    label: '投币箱',
    value: 'b_tb',
    type: 'switch',
    typevalue: '23',
    upvalue: 'port',
  },
  {
    label: '充电时间',
    value: 'tbsj',
    dw: '分',
    defaultValue: '240',
    typevalue: '23',
    upvalue: 'xt',
    if: { zhi: [{ value: 'b_tb', zhi: ['1'] }] },
  },

  {
    label: '插拔检测',
    value: 'b_dd',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['39', '38'],
  },
  {
    label: '面板灯开关',
    value: 'b_dg',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['37', '36'],
  },
  {
    label: '防扰民',
    value: 'b_atyy',
    type: 'switch',
    upvalue: 'b_atyy',
    typevalue: 'b_atyy',
    typeurl: '/ChargeCfgedt',
  },
  {
    label: '充满自停',
    value: 'b_cbdd',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['56', '55'],
  },
]
let ChargeSetaddjsonqc = [
  {
    label: '声音调节',
    value: 'b_yy',
    typevalue: '27',
    dw: '级(db)',
    upvalue: 'xt',
  },
  // {
  //   label: '电流最大值',
  //   value: 'maxdl',
  //   typevalue: '11',
  //   dw: 'A',
  //   fl: '10',
  //   upvalue: 'xt',
  //   defaultValue: '4',
  // },
  {
    label: '风扇最高温度',
    value: 'wdsbal',
    typevalue: '31',
    upvalue: 'xt',
    dw: '度',
  },
  {
    label: '风扇最低温度',
    value: 'wdxlal',
    typevalue: '32',
    upvalue: 'xt',
    dw: '度',
  },
  {
    label: '最大充电时长',
    value: 'maxt',
    typevalue: 'maxt',
    upvalue: 'maxt',
    dw: '分钟',
    typeurl: '/ChargeCfgedt',
  },
  {
    label: '防扰民',
    value: 'b_atyy',
    type: 'switch',
    typevalue: 'b_atyy',
    upvalue: 'b_atyy',
    typeurl: '/ChargeCfgedt',
  },
  {
    label: '设备指示灯',
    value: 'b_dd',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['39', '38'],
  },
  {
    label: '防倾倒',
    value: 'b_cbdd',
    type: 'switch',
    upvalue: 'lx',
    typevalue: ['56', '55'],
  },
]

ChargeSetaddjsoncar.forEach((e) => {
  if (!e.typeurl) {
    e.typeurl = '/ChargeSetadd'
  }

  e.if = e.if ? e.if : {}
  e.if = deepMerge(e.if, {
    zhierror: [
      { value: 'b_ask', zhi: ['1'] },
      { value: 'gtype', zhi: [...qcctype] },
    ],
  })
})
ChargeSetaddjsoncarb_ask.forEach((e) => {
  if (!e.typeurl) {
    e.typeurl = '/ChargeAskadd'
  }
  // ChargeAskadd
  e.if = e.if ? e.if : {}
  e.if = deepMerge(e.if, {
    zhierror: [{ value: 'gtype', zhi: [...qcctype] }],
    zhimust: [{ value: 'b_ask', zhi: ['1'] }],
  })
})
ChargeSetaddjsonqc.forEach((e) => {
  if (!e.typeurl) {
    e.typeurl = '/ChargeSetadd'
  }
  e.if = e.if ? e.if : {}
  e.if = deepMerge(e.if, {
    zhi: [{ value: 'gtype', zhi: [...qcctype] }],
  })
})
chargecarsetjson = chargecarsetjson
  .concat(deepClone(ChargeSetaddjsoncar))
  .concat(deepClone(ChargeSetaddjsoncarb_ask))
  .concat(deepClone(ChargeSetaddjsonqc))
  .concat([
    {
      value: 'HDVersj',
      label: '远程升级',
      type: 'switch',
      typevalue: '8',
      upvalue: 'xt',
      typeurl: '/ChargeAskadd',
      if: {
        zhimust: [
          { value: 'b_ask', zhi: ['1'] },
          { value: 'HDVerdata', zhi: [1] },
        ],
      },
    },
    {
      value: 'HDVersj',
      label: '远程升级',
      type: 'switch',
      typevalue: '8',
      upvalue: 'xt',
      typeurl: '/ChargeSetadd',
      if: {
        zhierror: [{ value: 'b_ask', zhi: ['1'] }],
        zhimust: [{ value: 'HDVerdata', zhi: [1] }],
      },
    },
  ])
export default {
  chargesetjson: chargesetjson,
  chargecarsetjson: chargecarsetjson,
  chargesetfalgjson: {
    if: {
      zhierror: [{ value: 'gtype', zhi: ['61', '62'] }],
    },
  },
}
